from selenium import webdriver

class TestCase:
    def __init__(self):
        self.driver = webdriver.Chrome()
        self.driver.get('https://www.baidu.com')
    def id(self):
        print(self.driver.find_element_by_id('kw').get_attribute('outerHTML'))

    def class_name(self,name1):
        print(self.driver.find_element_by_class_name(name1).get_attribute('outerHTML'))
    def link_text(self,text):
        print(self.driver.find_element_by_link_text(text).get_attribute('outerHTML'))

    def partial_link_text(self,text):
        print(self.driver.find_element_by_partial_link_text(text).get_attribute('outerHTML'))

    def name(self,name):
        print(self.driver.find_element_by_name(name).get_attribute('outerHTML'))

    def tag_name(self,name):
        print(self.driver.find_element_by_tag_name(name).get_attribute('outerHTML'))

if __name__ == '__main__':
    case = TestCase()
    # case.id()
    # case.class_name('s_ipt')
    # case.link_text('hao123')

    # case.partial_link_text('hao')

    # case.partial_link_text('123')

    case.tag_name('input')
    case.name('wd')

    case.driver.quit()
